diff -Naur kegs.1.05/src/xdriver.c kegs.1.05.patched/src/xdriver.c
--- kegs.1.05/src/xdriver.c	2021-01-24 18:37:34.000000000 -0500
+++ kegs.1.05.patched/src/xdriver.c	2021-02-25 17:53:28.054595900 -0500
@@ -629,13 +629,10 @@
 		0, &my_winSizeHints, 0, &my_winClassHint);
 	XMapRaised(g_display, x_win);
 
-	if(win_info_ptr != &g_mainwin_info) {
-		// Debugger window
 		win_info_ptr->delete_atom = XInternAtom(g_display,
 						"WM_DELETE_WINDOW", False);
 		XSetWMProtocols(g_display, x_win, &(win_info_ptr->delete_atom),
 									1);
-	}
 
 	XSync(g_display, False);
 
@@ -1092,9 +1089,15 @@
 		case ClientMessage:
 			win_info_ptr = x_find_xwin(ev.xclient.window);
 			if(ev.xclient.data.l[0] == win_info_ptr->delete_atom) {
-				// This is a WM_DELETE_WINDOW event
-				// Just unmap the window
-				win_info_ptr->kimage_ptr->active = 0;
+				if(win_info_ptr == &g_debugwin_info) {
+					// This is a WM_DELETE_WINDOW event
+					// Just unmap the window
+					win_info_ptr->kimage_ptr->active = 0;
+				} else {
+					x_auto_repeat_on(1);
+					XCloseDisplay(g_display);
+					exit(0);
+				}
 			} else {
 				printf("unknown ClientMessage\n");
 			}
